﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Admin_number.Aspx.cs" Inherits="Admin_number" %>

<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>馆 号 管 理</title>
    <link href="Css/Css.css" rel="stylesheet" type="text/css" />

    <script src="../Script/formValidator/jquery_last.js" type="text/javascript"></script>

    <script src="../Script/formValidator/formValidator.js" type="text/javascript" charset="UTF-8"></script>

    <script src="../Script/formValidator/formValidatorRegex.js" type="text/javascript" charset="UTF-8"></script>

    <script type="text/javascript">
        $(document).ready(function() {
            $.formValidator.initConfig({ formid: "Form1", alertmessage: true, onerror: function(msg) { alert(msg) } });
            $("#Txt_Num").formValidator({ onshow: "", oncorrect: "输入正确" }).regexValidator({ regexp: "num", datatype: "enum", onerror: "请输入正确的馆号，馆号必须为数字!" })
           .ajaxValidator({
               type: "get",
               url: "../AjaxXml/SaleNumber_Is.aspx?Rnd=" + new Date(),
               pre_proc: function() {
                   var v = 'SaleNum=' + $('#Txt_Num').val() + '&Types=' + $('#ChannelType').val();
                   return v;
               },
               datatype: "html",
               success: function(data) {
                   if (data == "1") {
                       this.onerror = "您输入的馆号已经存在,不能重复输入";
                       return false;
                   }
                   else if (data == "0") {
                       this.onerror = null;
                       return true;
                   }
                   else {
                       this.onerror = "未知错误!";
                       return false;
                   }
               },
               buttons: $("#Button2"),
               error: function() { alert("服务器没有返回数据，可能服务器忙，请重试"); },
               onerror: "您输入的馆号不可用，请更换!",
               onwait: "正在对馆号进行合法性校验，请稍候..."
           });
           ///这里要注意一下,为什么在返回数据的时候,success一直会弹出alert,不晓得数据会不会在后台一直执行.
           $("#Button2").formValidator({ onshow: "", oncorrect: "输入正确" }).ajaxValidator({
               type: "get",
               url: "../AjaxXml/SaleNumber_Is.aspx?Rnd=" + new Date(),
               pre_proc: function() {
                   var v = 'SaleNum=' + $('#Txt_Num').val() + '&Types=' + $('#ChannelType').val();
                   return v;
               },
               datatype: "html",
               success: function(data) {
                   //alert(data);
                   if (data == "1") {
                       this.onerror = "您输入的馆号已经存在,不能重复输入";
                       return false;
                   }
                   else if (data == "0") {
                       this.onerror = null;
                       return true;
                   }
                   else {
                       this.onerror = "未知错误!";
                       return false;
                   }
               },
               buttons: $("#Button2"),
               error: function() { alert("服务器没有返回数据，可能服务器忙，请重试"); },
               onerror: "您输入的馆号不可用，请更换!",
               onwait: "正在对馆号进行合法性校验，请稍候..."
           });           
            $("#Txt_MemberPrice").formValidator({ onshow: "", oncorrect: "输入正确" }).regexValidator({ regexp: "money", datatype: "enum", onerror: "会员价格的必须输入正确，最多为两位小数!" });
            $("#Txt_AgentPrice").formValidator({ onshow: "", oncorrect: "输入正确" }).regexValidator({ regexp: "money", datatype: "enum", onerror: "代理价格的必须输入正确，最多为两位小数!" });
        });
  </script>

</head>
<body>
    <form id="Form1" runat="server">
    <table cellpadding="0" cellspacing="1" border="0" width="100%" class="border" align="center">
        <tr>
            <td colspan="2" align="center" class="title">
                <strong>馆 号 管 理</strong>
            </td>
        </tr>
        <tr class="tdbg">
            <td width="70" height="30">
                <strong>管理导航：</strong>
            </td>
            <td height="30"> <a href="Admin_number.Aspx">充值卡管理</a>&nbsp;|&nbsp;<a href="Admin_number.Aspx?action=add">添加新馆号</a></td>
        </tr>
    </table>
    <asp:Panel ID="Pl_Add" runat="server">
        <table cellpadding="0" cellspacing="1" border="0" width="100%" class="border" align="center">
            <tr>
                <td colspan="2" align="center" class="title">
                    <strong>馆 号 管 理</strong>
                </td>
            </tr>
            <tr class="tdbg">
                <td width="300" height="25" valign="middle">
                    <strong>馆号：</strong>
                </td>
                <td height="25">
                    
                    <asp:TextBox ID="Txt_Num" runat="server" MaxLength="8"></asp:TextBox>
                </td>
            </tr>
            <tr class="tdbg">
                <td width="300" height="25">
                    <strong>所属类别：</strong>
                </td>
                <td height="25">
                    <asp:DropDownList ID="ChannelType" runat="server">
                    </asp:DropDownList>
                </td>
            </tr>
            <tr class="tdbg">
                <td width="300" height="25">
                    <strong>会员价格：</strong>
                </td>
                <td height="25">
                    <asp:TextBox ID="Txt_MemberPrice" runat="server"></asp:TextBox>
                </td>
            </tr>
            <tr class="tdbg">
                <td height="25" width="300">
                    <strong>代理价格：</strong>
                </td>
                <td height="25">
                    <asp:TextBox ID="Txt_AgentPrice" runat="server"></asp:TextBox>
                </td>
            </tr>
            <tr class="tdbg">
                <td width="300" height="25">
                    <strong>是否推荐：</strong>
                </td>
                <td height="25">
                    <asp:RadioButtonList ID="IsCommend" runat="server" RepeatColumns="10">
                        <asp:ListItem Selected="True" Value="1">是</asp:ListItem>
                        <asp:ListItem Value="0">否</asp:ListItem>
                    </asp:RadioButtonList>
                </td>
            </tr>
            <tr class="tdbg">
                <td height="40" colspan="2" align="center">
                    <input name="Action" type="hidden" id="Action" value="SaveModify">
                    <asp:Button ID="Button2" runat="server" Style="cursor: hand; background-color: #cccccc;"
                        Text="  确     定  " OnClick="Button2_Click" />&nbsp;
                </td>
            </tr>
        </table>
    </asp:Panel>
    <asp:Panel ID="Pl_Manager" runat="server">
        <table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="border">
            <tr class="title">
                <td height="30" align="center">
                    出售的馆号
                </td>
                <td height="30" align="center">
                    所属类型
                </td>
                <td height="30" align="center">
                    代理价
                </td>
                <td height="30" align="center">
                    会员价
                </td>
                <td height="30" align="center">
                    是否推荐
                </td>
                <td height="30" align="center">
                    操作
                </td>
            </tr>
            <asp:Repeater ID="Repeater1" runat="server" OnItemCommand="Repeater1_ItemCommand"
                OnItemDataBound="Repeater1_ItemDataBound">
                <ItemTemplate>
                    <tr class="tdbg" onmouseout="this.style.backgroundColor=''" onmouseover="this.style.backgroundColor='#cccccc'"
                        style="padding: 0px 2px;">
                        <td height="30" align="center">
                            <%#Eval("Number")%>
                        </td>
                        <td align="center">
                            <%#AspNetCs.Bll.Channel.ChannelStr(AspNetCs.Common.StringHelper.isNumber_int(Eval("SaleType").ToString()))%>
                        </td>
                        <td align="center">
                            ￥<%#Eval("AgentPrice", "{0:#.##}")%>元
                        </td>
                        <td align="center">
                            ￥<%#Eval("MemberPrice", "{0:#.##}")%>元
                        </td>
                        <td align="center">
                            <%#Sale.IsCommend(Eval("ReCommend").ToString()) %>
                        </td>
                        <td align="center"><asp:LinkButton ID="linkbtn" runat="server" CommandName="priceuse" CommandArgument='<%#Eval("id")%>' >使用</asp:LinkButton>
                        <asp:LinkButton ID="linkdel" runat="server">删除</asp:LinkButton>
                        </td>
                    </tr>
                </ItemTemplate>
                <FooterTemplate>
                    <asp:Panel ID="pl_nothing" runat="server" Visible="false">
                        <tr>
                            <td colspan="10">
                                暂时没有任何友情链接数据
                            </td>
                        </tr>
                    </asp:Panel>
                </FooterTemplate>
            </asp:Repeater>
            <tr class="tdbg">
                <td colspan="7" height="25" align="right">
                    <webdiyer:AspNetPager ID="AspNetPager1" runat="server" OnPageChanged="AspNetPager1_PageChanged"
                        CurrentPageButtonPosition="Beginning" CustomInfoHTML="共%PageCount%页，当前为第%CurrentPageIndex%页，每页%PageSize%条"
                        LayoutType="Table" NumericButtonTextFormatString="[{0}]" PageIndexBoxType="DropDownList"
                        PageSize="15" ShowCustomInfoSection="Left" ShowPageIndexBox="Always" SubmitButtonText="Go"
                        TextAfterPageIndexBox="页" TextBeforePageIndexBox="转到" UrlPaging="True" AlwaysShow="True">
                    </webdiyer:AspNetPager>
                </td>
            </tr>
        </table>
    </asp:Panel>
    </form>
</body>
</html>